

<div id='index_main2'>
	<div id='indexMian2_area'>
		<h1 style='text-align:center;color:red'>区域审核</h1>
		<div style='text-align:center;font-size:12px;position:fixed;top:8px;left:10px'>
			当前：<span id='currentCityView'></span>　
			<span style='color:blue;cursor:pointer' onclick='_changeCity()'>切换</span>
		</div>

		<div style='margin:20px auto;text-align:center'>
			状态：
			<select id="statSel">
				<option value="all">全部</option>
				<option value="1">待审</option>
				<option value="2">正常</option>
				<option value="3">未通过</option>
			</select>
		</div>
		

		<div id='indexMain2_list'>
			<div style='width:80%;border:0px solid;margin:15px auto;display:flex'>
				<span style='width:200px;border:0px solid;text-align:right;overflow:hidden;white-space: nowrap'>
					顶号国协佃螺蛳粉aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
				</span>
				<span style='flex:1;text-align:center'>
					<button>查看</button>
				</span>
			</div>
		</div>
		<div id='fpage' style='text-align:center;margin:50px auto'></div>
	</div>



	<div id='areaCheck2' style='display:none'>
		<div style='margin:50px auto;width:60%'>
			<div style='text-align:center'><h2 id='item_title'>标题</h2></div>
			<div style='margin:30px auto' id='item_content'></div>
			<div style='margin:30px auto'>类　别：<span id='item_type'></span></div>
			<div style='margin:30px auto'>联系人：<span id='item_concat'></span></div>
			<div style='margin:30px auto'>电　话：<span id='item_phone'></span></div>

			<div style='text-align:center'>
				<button onclick='_agree2(2)'>通过</button>　
				<button onclick='_agree2(3)'>不通过</button>　
				<button onclick='_checkBack2()'>返回</button>
			</div>
		</div>
	</div>

	<span style='position:fixed;top:8px;right:110px;cursor:pointer;color:#1a2' onclick='_jumpMain()'>总览审核</span>
</div>
<script>
	if(!sessionStorage.cityCode){
		_changeCity();
	}else{
		$('#currentCityView').text(sessionStorage.cityName);

		//加载区域信息
		_init2();


		$('#statSel').change(function(){
			pNow = 1;
			parseCityData();
		});
	}


function _checkBack2(){
	$("#indexMian2_area").show();
	$("#areaCheck2").hide();
}



function _init2(){
	$("#indexMian2_area").show();
	$("#areaCheck2").hide();
	_getCityDataList(sessionStorage.cityCode,function(){
	//	C(cityData);
		if(!cityData){
			_changeCity();
			return;
		}
		parseCityData();
	},1)
}




function _look2(id){
	$("#indexMian2_area").hide();
	$("#areaCheck2").show();
	sessionStorage.checkId = id;
	for(var i=0;i<cityData.list.length;i++){
		if(cityData.list[i][0] == id){
			inStat = 1;
			$('#item_title').text(cityData.list[i][1]);
			$('#item_content').text(cityData.list[i][2]);
			switch(cityData.list[i][5]){
				case 1:case '1':var tmpStat='房产信息';break;
				case 2:case '2':var tmpStat='二手车';break;
				case 3:case '3':var tmpStat='闲置物品';break;
				case 4:case '4':var tmpStat='招聘求职';break;
				case 5:case '5':var tmpStat='失物招领';break;
				case 6:case '6':var tmpStat='其它';break;
			}
			$('#item_type').text(tmpStat);
			$('#item_concat').text(cityData.list[i][3]);
			$('#item_phone').text(cityData.list[i][4]);
		}
	}
}



//审核信息
function _agree2(val){
	Notice('');
	Notice('处理中......');
	Ajax({type:'agree','cityCode':sessionStorage.cityCode,'id':sessionStorage.checkId,'val':val},function(res){
		if(res == 'wait'){
			agreeTime += 1000;
			var sil = setTimeout(function(){
				if(agreeTime > 5000){
					agreeTime = 0;
					Notice('');
					A('服务器繁忙，稍候再试！');
				}else{
					_agree2(val);
				}
			},1000);
		}else{
			Notice('');
			_init2();
		}
	},'interface.php');
}







function parseCityData(){
	if(cityData && cityData.list && typeof(cityData.list) == 'object' && cityData.list.length > 0){
		var tmpData2 = cityData.list;
		var tmpData = [];


		var statVal = $('#statSel').find('option:selected').val();

		for(var i=0;i<tmpData2.length;i++){
			var viewStat = 0;
			if(statVal == 'all' || statVal == tmpData2[i][6]){
				viewStat = 1;
			}
			if(viewStat){
				tmpData.push(tmpData2[i]);
			}
		}





		var str = '';
		var start = (pNow - 1) * mainPLength;
		var end = start + mainPLength < tmpData.length?start + mainPLength:tmpData.length;
		if(start + mainPLength < tmpData.length){
			var end = start + mainPLength
			pMax = pNow + 1;
		}else{
			var end = tmpData.length;
			pMax = pNow;
		}
		var statVal = $('#statSel').find('option:selected').val();

		for(var i=start;i<end;i++){
			str += "<div style='width:80%;border:0px solid;margin:15px auto;display:flex'>";
				str += "<span style='width:200px;border:0px solid;text-align:center;overflow:hidden;white-space: nowrap'>";
					str += tmpData[i][1];

				str += "</span>";
				str += "<span style='flex:1;text-align:center'>";
					switch(tmpData[i][6]){
						case 1:case '1':var infoStat = '待审';break;
						case 2:case '2':var infoStat = '正常';break;
						case 3:case '3':var infoStat = '未通过';break;
					}
					str += "<span>"+infoStat+"</span>　<button onclick=_look2('"+tmpData[i][0]+"')>查看</button>";
				str += "</span>";
			str += "</div>";
		}
		$('#indexMain2_list').html(str);

		Fpage(pNow,pMax,function(p){
			pNow = p;
			parseCityData();
		},1,1,'#fpage')	
	}else{
		$('#indexMain2').html('<h2 style="color:#a1c;margin:50px;text-align:center">暂无数据</h2>');
	}
}





function _changeCity(){
	cityData = '';
	Ajax({},function(res){
		$('#indexArea').html(res);
	},'./index_city.html')
}
</script>
